package com.itheima.test;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;

public class MyService {
    private static final Logger logger = LoggerFactory.getLogger(MyService.class);
    
    public void doSomething() {
        logger.info("Entering method doSomething");
        String sensitiveData = "secret";
        try {
            logger.debug("Processing data: {}", sensitiveData);
        } catch (Exception e) {
            logger.error("Error occurred while processing", e);
            MDC.put("requestId", "12345");
            logger.warn("Operation failed with requestId: {}", MDC.get("requestId"));
            MDC.clear();
        }
        int userId = 123;
        String resourceId = "resourceId";
        logger.info("User {} accessed resource {}", userId, resourceId);
    }

    public static void main(String[] args) {
          new MyService().doSomething();
    }
}